package bairui.international.service;

import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import bairui.international.model.domain.jpa.TB_BranchCompany;
import bairui.international.model.domain.jpa.TB_BranchCompanyStaff;
import bairui.international.model.domain.jpa.TB_ElectronicTicket;
import bairui.international.model.domain.jpa.TB_Product;
import bairui.international.model.domain.jpa.TB_ProductOrder;
import bairui.international.model.domain.jpa.TB_Town;
import bairui.international.model.domain.jpa.TB_User;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 
 * 【(产品订单)TB_ProductOrder】服务接口
 *
 * @generated
 * 
 * @see bairui.international.model.domain.jpa.产品订单.TB_ProductOrder 模型
 * @see BService_ProductOrder 服务接口基础
 *
 */
@Transactional(rollbackFor=Throwable.class,readOnly=true)
public interface Service_ProductOrder extends BService_ProductOrder {

//	@Transactional(rollbackFor=Throwable.class)
//	TB_ProductOrder createInstance(TB_User user, TB_Product product, TB_ProxyArea proxyArea, Double price, Long amount, Double score, Type_ProductOrder type, String imgUrl);

//	@Transactional(rollbackFor=Throwable.class)
//	TB_ProductOrder createBuyOrder(TB_User user, TB_Product product, TB_ProxyArea proxyArea, Double price, Long amount, String imgUrl);
	
	@Transactional(rollbackFor=Throwable.class)
	void cancelGradeOrder(long id) throws Exception;
	
	@AllArgsConstructor
	public static class CreatePackOrderInput {
		private @Getter long productId;
		private @Getter String productName;
		private @Getter String productImgUrl;
		private @Getter long amount;
	}

	@AllArgsConstructor
	public static class InputForCreate {
		private @Getter TB_Product product;
		private @Getter long amount;
	}
	@Transactional(rollbackFor=Throwable.class)
	TB_ProductOrder create(TB_User user, List<InputForCreate> inputs) throws Exception;
	
	@Transactional(rollbackFor=Throwable.class)
	TB_ProductOrder createGradeOrder(TB_User user, List<InputForCreate> inputs) throws Exception;

	@Transactional(rollbackFor=Throwable.class)
	void cancelOrder(long id) throws Exception;
	
	@Transactional(rollbackFor=Throwable.class)
	TB_ProductOrder onLinePay(String orderNumber) throws Exception;

	@Transactional(rollbackFor=Throwable.class)
	TB_ProductOrder send(long id) throws Exception;

	@Transactional(rollbackFor=Throwable.class)
	TB_ProductOrder cancel(long id) throws Exception;

	@Transactional(rollbackFor=Throwable.class)
	TB_ProductOrder terminal(long id) throws Exception;
	
//	@Transactional(rollbackFor=Throwable.class)
//	TB_ProductOrder vertifyPass(long id) throws Exception;
//
	@Transactional(rollbackFor=Throwable.class)
	void finish(long id) throws Exception;
	
	@Transactional(rollbackFor=Throwable.class)
	void payUnderLine(Double score, long orderId, Long ticketId, TB_Town town, String username, String phone, String address, String orderComment) throws Exception;

	@Transactional(rollbackFor=Throwable.class)
	TB_ProductOrder setScore(long id, Double score, TB_ElectronicTicket ticket) throws Exception;

	@Transactional(rollbackFor=Throwable.class)
	TB_ProductOrder gradeOrderPay(String skey, long id, String username, String phone, String area, String detailAddress, Long townId, String comment) throws Exception;

	@Transactional(rollbackFor=Throwable.class)
	void setRemitImgUrl(long id, String remitImgUrl);

	/**
	 * 列出需要处理过期任务的订单
	 */
	List<TB_ProductOrder> listExpireTaskOrder();

	@Transactional(rollbackFor=Throwable.class)
	void assign(long id, String skey, TB_BranchCompanyStaff branchCompanyStaff) throws Exception;

	@Transactional(rollbackFor=Throwable.class)
	void assignBranchCompany(long id, TB_BranchCompany branchCompany) throws Exception;

	@Transactional(rollbackFor=Throwable.class)
	void setOrderInfo(TB_ProductOrder order, TB_Town town, String username, String phone, String address, String orderComment) throws Exception;

	@Transactional(rollbackFor=Throwable.class)
	void submitVerify(long id) throws Exception;

	@Transactional(rollbackFor=Throwable.class)
	void verifyPass(long id) throws Exception;

	@Transactional(rollbackFor=Throwable.class)
	TB_ProductOrder vertifyGradeOrderNoPass(long id, String message) throws Exception;

	@Transactional(rollbackFor=Throwable.class)
	TB_ProductOrder vertifyGradeOrderPass(long id) throws Exception;

}
